-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Line Messaging API - new/migrated components #18008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughIntroduces LINE Messaging API support: adds client methods, four message-sending actions (broadcast, multicast, push, reply), a webhook base with activation logic, a “New Message Received (Instant)” source handling incoming events, a test event fixture, and updates package.json with dependency and version. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action as Pipedream Action
participant App as LINE App Wrapper
participant LINE as LINE Messaging API
User->>Action: Provide inputs (to/message/flags)
Action->>App: sendPush/Reply/Multicast/Broadcast(data)
App->>LINE: POST /message/{operation}
LINE-->>App: API response
App-->>Action: Response
Action-->>User: $summary + response
sequenceDiagram
participant Source as Source (New Message Received)
participant Base as Base Webhook
participant App as LINE App Wrapper
participant LINE as LINE Messaging API
activate Source
Source->>Base: hooks.activate()
Base->>App: getWebhook()
App->>LINE: GET /channel/webhook/endpoint
LINE-->>App: Endpoint (or 404)
Base->>App: createWebhook({ endpoint: http.endpoint })
App->>LINE: PUT /channel/webhook/endpoint
LINE-->>App: OK
deactivate Source
LINE->>Source: POST webhook payload
Source->>Source: Validate events and type==="message"
Source-->>Source: generateMeta()
Source-->>Source: $emit(event, meta)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (5)
components/line_messaging_api/line_messaging_api.app.mjs (2)
7-11: Tighten copy: minor grammar improvement“The text of message to send” → “The text of the message to send”.
message: { label: "Message Text", type: "string", - description: "The text of message to send", + description: "The text of the message to send", },
12-18: Clarify notificationDisabled semantics (current description is misleading)The label suggests disabling notifications, but the description says users will receive notifications. Update to reflect true semantics.
notificationDisabled: { - label: "Disable Notification", + label: "Disable Notifications", type: "boolean", - description: "The user will receive a push notification when the message is sent", + description: "If true, the user will not receive a push notification when the message is sent", default: false, optional: true, },components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
11-15: Clarify recipient constraints in the descriptionAdd note on allowed range per LINE API (2–500 userIds).
to: { label: "To", type: "string[]", - description: "An array of user IDs to send the message to", + description: "An array of user IDs to send the message to (between 2 and 500 recipients)", },components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
12-15: Clarify recipient identifier wordingSmall copy tweak to explicitly call out userId, groupId, or roomId.
to: { label: "To", type: "string", - description: "The ID of user, group, or room the message will be sent to", + description: "The userId, groupId, or roomId to send the message to", },components/line_messaging_api/sources/new-message-received/new-message-received.mjs (1)
12-21: Consider defensive handling for non-text messages.The
generateMetaimplementation looks good, but consider handling cases whereevent.message.textmight be undefined for non-text message types (images, stickers, etc.).generateMeta(event) { return { id: event.message.id, - summary: event.message.text, + summary: event.message.text || `${event.message.type} message`, ts: event.timestamp, }; },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs(1 hunks)components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs(1 hunks)components/line_messaging_api/actions/send-push-message/send-push-message.mjs(1 hunks)components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs(1 hunks)components/line_messaging_api/line_messaging_api.app.mjs(1 hunks)components/line_messaging_api/package.json(2 hunks)components/line_messaging_api/sources/common/base-webhook.mjs(1 hunks)components/line_messaging_api/sources/new-message-received/new-message-received.mjs(1 hunks)components/line_messaging_api/sources/new-message-received/test-event.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Applied to files:
components/line_messaging_api/sources/common/base-webhook.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/line_messaging_api/package.json
🧬 Code Graph Analysis (4)
components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (3)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
response(30-42)components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1)
response(25-36)components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
response(30-42)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (3)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1)
response(25-36)components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
response(30-42)components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1)
response(30-42)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (3)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
response(30-42)components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
response(30-42)components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1)
response(30-42)
components/line_messaging_api/actions/send-push-message/send-push-message.mjs (3)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
response(30-42)components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1)
response(25-36)components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1)
response(30-42)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
🔇 Additional comments (18)
components/line_messaging_api/package.json (2)
3-3: Version bump looks goodPackage version update to 0.1.0 aligns with introducing new public surface (app wrappers, actions, source).
15-17: Dependency addition is appropriate and compliant with org learningsAdding "@pipedream/platform" is required for axios usage in the app. Also, thanks for not adding built-in Node modules as dependencies—this follows our learning on avoiding native modules in package.json.
components/line_messaging_api/sources/new-message-received/test-event.mjs (1)
1-19: Sample event LGTMShape matches a LINE message event and is suitable for sampleEmit. Values appear non-sensitive.
components/line_messaging_api/line_messaging_api.app.mjs (3)
35-75: Endpoint wrappers map correctly to LINE Messaging APIcreateWebhook/getWebhook and message send (push/reply/multicast/broadcast) routes look correct and consistent.
24-33: Require valid step context ($) and set JSON content-type in requestsDefaulting
$ = thismay mask missing or invalid step contexts and lead to runtime errors in the Pipedream axios client. Enforce$as a required parameter and explicitly set the JSON content‐type header for all requests.Suggested diff:
- _makeRequest({ - $ = this, path, ...opts - }) { - return axios($, { + _makeRequest({ $, path, ...opts }) { + if (!$) { + throw new Error("Missing step context ($). Pass {$} when calling app methods."); + } + return axios($, { url: `${this._baseUrl()}${path}`, headers: { Authorization: `Bearer ${this.$auth.long_lived_channel_access_token}`, + "Content-Type": "application/json", }, ...opts, });• I ran the provided grep commands to confirm all callers pass
{$}, but they returned no matches undercomponents/line_messaging_api/.
• Please manually verify that every invocation of your app methods (e.g.sendPushMessage,replyMessage,getWebhook, etc.) includes the step context object{ $ }.
29-31: Confirm auth token key matches the app auth schema
The_makeRequestmethod usesthis.$auth.long_lived_channel_access_tokenfor the Authorization header, but this file doesn’t define any auth props. Please verify that your app’s auth configuration declares a secret namedlong_lived_channel_access_token(not, for example,channel_access_token), or update the code to use the correct$authfield—otherwise API calls will fail with 401 Unauthorized.components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
29-45: Run logic LGTMPayload structure and wrapper usage are correct; summary is helpful.
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (3)
1-8: LGTM!The import path and action structure follow standard Pipedream patterns correctly.
9-23: LGTM!Props structure is consistent with other LINE messaging actions and correctly uses propDefinitions for shared properties.
24-40: LGTM!The run function implementation correctly follows the LINE API structure and is consistent with other messaging actions in the PR. The nullish coalescing operator usage and summary export are appropriate.
components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (3)
1-8: LGTM!Import and action structure are consistent with other LINE messaging actions.
9-28: LGTM!Props structure correctly adds the reply-specific
replyTokenprop while reusing shared propDefinitions for common properties.
29-46: LGTM!The run function correctly implements the reply message pattern with the required
replyTokenfield and provides a helpful summary message.components/line_messaging_api/sources/common/base-webhook.mjs (2)
1-8: LGTM!Import statements and base structure are appropriate for a webhook base class.
9-26: LGTM!The activate hook implementation correctly sets up the webhook with appropriate error handling and user guidance. The sequence of operations and error messaging provide good developer experience.
components/line_messaging_api/sources/new-message-received/new-message-received.mjs (3)
1-11: LGTM!Import statements and source structure correctly extend the base webhook with appropriate metadata.
22-32: LGTM!The run function correctly handles LINE webhook events with proper filtering and emission. The early return and event type filtering are appropriate defensive programming practices.
33-34: LGTM!Sample emit usage follows standard Pipedream patterns.
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs
Show resolved
Hide resolved
luancazarine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927, LGTM! Ready for QA!
Resolves #17932
Summary by CodeRabbit